Skip to content

fix: clamp logderivative inverse range to fix nightly debug build OOB#22312

Draft
AztecBot wants to merge 1 commit intonextfrom
claudebox/fix-bb-debug-build
Draft

fix: clamp logderivative inverse range to fix nightly debug build OOB#22312
AztecBot wants to merge 1 commit intonextfrom
claudebox/fix-bb-debug-build

Conversation

@AztecBot
Copy link
Copy Markdown
Collaborator

@AztecBot AztecBot commented Apr 4, 2026

Summary

Fixes nightly barretenberg debug build which crashes with SIGABRT (exit code 134) in test AvmRecursiveTests.TwoLayerAvmRecursionFailsWithWrongPIs.

Root cause: In compute_logderivative_inverse(), the multi-threaded path splits work by circuit_size, but inverse_polynomial.coeffs() only covers the actual (non-virtual) data. When a thread chunk's start exceeds the polynomial's actual size, coeffs()[start] is out of bounds — caught by _GLIBCXX_DEBUG's span bounds checking in the debug build preset.

Fix: Clamp start/end to the polynomial's actual data range before batch_invert. Virtual zero elements need no inversion.

Note: The batch_invert reserve→resize fix from the original PR #22312 is no longer needed as it was already applied on next. PR #22314 can be closed as duplicate.

@AztecBot AztecBot added ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR. labels Apr 4, 2026
@AztecBot AztecBot force-pushed the claudebox/fix-bb-debug-build branch from f47dc94 to 46d1d71 Compare April 5, 2026 05:45
@AztecBot AztecBot changed the title fix: guard debug pairing point validation against off-curve points fix: guard debug-only pairing point validation and logderivative span OOB Apr 5, 2026
@AztecBot AztecBot force-pushed the claudebox/fix-bb-debug-build branch from 46d1d71 to 3da2230 Compare April 5, 2026 06:22
@AztecBot AztecBot changed the title fix: guard debug-only pairing point validation and logderivative span OOB fix: use resize instead of reserve in batch_invert to fix UB Apr 5, 2026
@AztecBot AztecBot force-pushed the claudebox/fix-bb-debug-build branch from 3da2230 to e2886cd Compare April 5, 2026 06:37
@AztecBot AztecBot changed the title fix: use resize instead of reserve in batch_invert to fix UB fix: resolve UB in batch_invert and logderivative OOB in debug builds Apr 5, 2026
@AztecBot AztecBot force-pushed the claudebox/fix-bb-debug-build branch 2 times, most recently from 09f9ec4 to 8b8ea8c Compare April 6, 2026 06:02
In compute_logderivative_inverse(), the multithreaded path partitions
work by circuit_size but inverse_polynomial.coeffs() can be smaller
than circuit_size (virtual zero elements). When a thread chunk's start
exceeds the polynomial's actual data size, coeffs()[start] is out of
bounds -- caught by _GLIBCXX_DEBUG's span bounds checking in the debug
build.

Fix: clamp start/end to the polynomial's actual data range before
calling batch_invert. Virtual zero elements need no inversion.
@AztecBot AztecBot changed the title fix: resolve UB in batch_invert and logderivative OOB in debug builds fix: clamp logderivative inverse range to fix nightly debug build OOB Apr 6, 2026
@AztecBot AztecBot force-pushed the claudebox/fix-bb-debug-build branch from 8b8ea8c to fc319eb Compare April 6, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant